/**
 * 南向设备 api 封装
 *
 * @Author:    hzw
 * @Date:      2024-08-04 15:31:22
 * @Copyright  xnr
 */
import { postRequest, getRequest, postDownload } from '/@/lib/axios';

export const iotDeviceApi = {

  /**
   * 分页查询  @author  hzw
   */
  queryPage: (param) => {
    return postRequest('/iotDevice/queryPage', param);
  },

  queryGroupList: (param) => {
    return postRequest('/iotDevice/queryGroupList', param);
  },

  /**
   * 详情查询  @author  hzw
   */
  getDetailById: (param) => {
    return postRequest('/iotDevice/queryOne', param);
  },

  /**
   * 增加  @author  hzw
   */
  add: (param) => {
    return postRequest('/iotDevice/add', param);
  },

  /**
   * 修改  @author  hzw
   */
  update: (param) => {
    return postRequest('/iotDevice/update', param);
  },


  /**
   * 删除  @author  hzw
   */
  delete: (id) => {
    return getRequest(`/iotDevice/delete/${id}`);
  },

  /**
   * 批量删除  @author  hzw
   */
  batchDelete: (idList) => {
    return postRequest('/iotDevice/batchDelete', idList);
  },

  // 设备开关控制
  switchStatus: (param) => {
    return postRequest('/iotDevice/switchStatus', param);
  },

  // 数据监控 设备ID和设备组ID 查询 数据
  queryMonitor: (param) => {
    return postRequest('/iotDevice/queryMonitor', param);
  },

  // testConnect
  // 测试连接（定时请求）
  testConnect: (param) => {
    return postRequest('/iotDevice/testConnect', param);
  },

  /**
   * 导入  @author  hzw
   */
  importFile: (param) => {
    return postRequest("/iotDevice/import", param);
  },

  /**
   * 导出  @author  hzw
   */
  exportFile: (param) => {
    return postDownload("/iotDevice/export", param);
  },
  // 保存排序
  saveOrder: (data, param) => {
     return postRequest('/iotDevice/sort', data, param);
   },
};
